import { redisService } from './global-setup';

// This function will be called after all tests are complete
export default async function () {
  console.log('Running global teardown...');

  try {
    if (redisService) {
      try {
        // Try to close the Redis connection
        await redisService.closeConnection();
        console.log('Redis connection closed successfully');
      } catch (error) {
        console.log('Redis connection already closed or error closing:', error.message);
      }
    } else {
      console.log('No Redis service instance found to close');
    }
  } catch (error) {
    console.log('Error in global teardown:', error.message);
  }
}
